package com.itheima.mapper;

import com.itheima.domain.User;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserMapper {
    @Select("select * from user where id=#{id}")
    @Results(id = "userMap",value = {
            @Result(id=true,column = "id",property = "id"),
            @Result(column = "username",property = "uname")
    })
    User findById(Integer id);

    @Select("select * from user")
    @ResultMap("userMap")
    List<User> findAll();
}
